package v1

import (
	"SSO/controllers/admin"
	"github.com/gin-gonic/gin"
	"net/http"
)

type Admin struct {}

func (Admin) Register(router *gin.RouterGroup){
	serviceController := admin.Service{}
	userController := admin.User{}
	adminV1 := router.Group("/admin")
	adminV1.GET("/", func(c *gin.Context) {
		c.HTML(http.StatusOK, "admin/index.html", nil)
	})
	serviceV1 := adminV1.Group("/service")
	{
		serviceV1.GET("/list", serviceController.List)
		serviceV1.POST("/add", serviceController.Create)
		serviceV1.POST("/edit", serviceController.Update)
		serviceV1.POST("/del", serviceController.Delete)
	}
	userV1 := adminV1.Group("/user")
	{
		userV1.POST("/edit/password", userController.UpdatePassword)
	}
}